package com.itcs.app;

import java.util.ArrayList;
import java.util.List;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

import com.itcs.app.itcapi.ITCWebFilter;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 服务启动
 * 
 * @author LiuPeng
 * @date 2017年12月6日
 * 
 */
@SpringBootApplication(scanBasePackages = { "com.itcs" })
@EnableSwagger2
@MapperScan("com.itcs.trading.mapper")
public class Application {

	public static void main(String[] args) throws Exception {
		SpringApplication.run(Application.class, args);
	}
	
	@Bean  
    public FilterRegistrationBean  filterRegistrationBean() {  
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();  
        registrationBean.setFilter(new ITCWebFilter());  
        List<String> urlPatterns = new ArrayList<String>();  
        urlPatterns.add("/user/*");  
        registrationBean.setUrlPatterns(urlPatterns);  
        return registrationBean;  
    }

}